package day05.homework;

import java.util.Random;

public class MethodDemo {
    public static void main(String[] args) {

        say();
        say("Jack");
        say("Mike", 18);
        int number = sum(12, 45);
        System.out.println(number);
        int[] arr = generateArray(12, 200);
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static void say() {
        System.out.println("大家好，我的名字是哇哈哈，今年44岁");
    }

    public static void say(String name) {
        System.out.println("大家好，我的名字是" + name + "，今年45岁");
    }

    public static void say(String name, int age) {
        System.out.println("大家好，我的名字是" + name + "，今年" + age + "岁");
    }

    public static int sum(int num1, int num2) {
        int num = num1 + num2;
        return num;
    }

    /**
     * 生成长度为len的0-max的随机数数组
     *
     * @param len
     * @param max
     * @return
     */
    public static int[] generateArray(int len, int max) {
        Random random = new Random();
        int[] arr = new int[len];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(max + 1);
        }
        return arr;
    }

}
